set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

protobuf_generate(hcom_graph_adaptor_proto  hcom_graph_adaptor_proto_c hcom_graph_adaptor_proto_h
                      ${CMAKE_CURRENT_SOURCE_DIR}/proto/task.proto TARGET
)
add_library(hcom_graph_adaptor  SHARED
                ${hcom_graph_adaptor_proto_h}
)
add_library(hcom_executor  SHARED
                ${hcom_graph_adaptor_proto_h}
)
add_library(hcom_opskernel_builder  SHARED
                ${hcom_graph_adaptor_proto_h}
)
add_library(hvd_opskernel_builder  SHARED
                ${hcom_graph_adaptor_proto_h}
)
add_library(hcom_gradtune_opskernel_builder  SHARED
                ${hcom_graph_adaptor_proto_h}
)
add_dependencies(hcom_graph_adaptor hcom_graph_adaptor_proto)
add_dependencies(hcom_executor hcom_graph_adaptor_proto)
add_dependencies(hcom_opskernel_builder hcom_graph_adaptor_proto)
add_dependencies(hvd_opskernel_builder hcom_graph_adaptor_proto)
add_dependencies(hcom_gradtune_opskernel_builder hcom_graph_adaptor_proto)

#hcom_graph_adaptor头文件和编译宏
target_compile_options(hcom_graph_adaptor  PRIVATE
    -Werror
    -fno-common
    -fno-strict-aliasing
    -pipe
    -fstack-protector-strong
    -std=c++14
)
target_compile_definitions(hcom_graph_adaptor  PRIVATE
    google=ascend_private
    $<$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>:HCOM_DEBUG_MODE>
)

#hcom_executor头文件和编译宏
target_compile_options(hcom_executor  PRIVATE
    -Werror
    -fno-common
    -fno-strict-aliasing
    -pipe
    -fstack-protector-strong
    -std=c++14
)
target_compile_definitions(hcom_executor  PRIVATE
    google=ascend_private
    $<$<STREQUAL:${CMAKE_BUILD_TYPE},Debug>:HCOM_DEBUG_MODE>
    HCOM_EXECUTOR
)

#hcom_opskernel_builder头文件和编译宏
target_compile_options(hcom_opskernel_builder  PRIVATE
    -Werror
    -fno-common
    -fno-strict-aliasing
    -pipe
    -fstack-protector-strong
    -std=c++14
)
target_compile_definitions(hcom_opskernel_builder  PRIVATE
    google=ascend_private
)

#hvd_opskernel_builder头文件和编译宏
target_compile_options(hvd_opskernel_builder  PRIVATE
    -Werror
    -fno-common
    -fno-strict-aliasing
    -pipe
    -fstack-protector-strong
    -std=c++14
)
target_compile_definitions(hvd_opskernel_builder  PRIVATE
    google=ascend_private
)


#hcom_gradtune_opskernel_builder头文件和编译宏
target_compile_options(hcom_gradtune_opskernel_builder  PRIVATE
    -Werror
    -fno-common
    -fno-strict-aliasing
    -pipe
    -fstack-protector-strong
    -std=c++14
)
target_compile_definitions(hcom_gradtune_opskernel_builder  PRIVATE
    google=ascend_private
)

#头文件搜索路径
#hcom_graph_adaptor头文件
target_include_directories(hcom_graph_adaptor PRIVATE
    ${TOP_DIR}/inc
    ${TOP_DIR}/metadef/inc
    ${TOP_DIR}/graphengine/inc
    ${TOP_DIR}/inc/external
    ${TOP_DIR}/inc/aicpu
    ${TOP_DIR}/metadef/inc/graph
    ${TOP_DIR}/libc_sec/include
    ${TOP_DIR}/open_source/json/include
    ${TOP_DIR}/abl/qos/qosmng
    ${CMAKE_CURRENT_SOURCE_DIR}/../inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/mc2_handler
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template/component/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/task
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/resource_manager
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/coll_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/config
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/hashtable
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl_heterog/rpc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl/hccl_comm/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/tbe_vector_reduce
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/alg_research/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/common/debug/profiling/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hcom_graph_adaptor/ge_plugin/hcom
    ${TOP_DIR}/metadef/inc/common
    ${TOP_DIR}/metadef/inc/common/util
    ${TOP_DIR}/graphengine/inc/framework
    ${TOP_DIR}/metadef/inc/external
    ${TOP_DIR}/graphengine/inc/external
    ${TOP_DIR}/metadef/inc/external/graph
    ${TOP_DIR}/metadef/inc/exe_graph/lowering
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/proto/hcom_graph_adaptor_proto
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/common
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hvd
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/auto_tuning
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/calculation_tool
    ${CMAKE_CURRENT_SOURCE_DIR}/hcom_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/evaluator
    ${TOP_DIR}/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/trace_manager
    ${TOP_DIR}/abl/adump/inc/adump
    ${TOP_DIR}/abl/atrace/inc/utrace
)

#hcom_graph_adaptor头文件
target_include_directories(hcom_executor PRIVATE
    ${TOP_DIR}/inc
    ${TOP_DIR}/metadef/inc
    ${TOP_DIR}/graphengine/inc
    ${TOP_DIR}/inc/external
    ${TOP_DIR}/inc/aicpu
    ${TOP_DIR}/metadef/inc/graph
    ${TOP_DIR}/libc_sec/include
    ${TOP_DIR}/open_source/json/include
    ${CMAKE_CURRENT_SOURCE_DIR}/../inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/mc2_handler
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template/component/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/task
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/resource_manager
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/coll_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/alg_research/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/common/debug/profiling/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/config
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/hashtable
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl_heterog/rpc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/tbe_vector_reduce
    ${TOP_DIR}/metadef/inc/common
    ${TOP_DIR}/metadef/inc/common/util
    ${TOP_DIR}/graphengine/inc/framework
    ${TOP_DIR}/metadef/inc/external
    ${TOP_DIR}/graphengine/inc/external
    ${TOP_DIR}/metadef/inc/external/graph
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/proto/hcom_graph_adaptor_proto
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/common
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hvd
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/auto_tuning
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/calculation_tool
    ${CMAKE_CURRENT_SOURCE_DIR}/hcom_executor
    ${TOP_DIR}/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/error_manager
    ${TOP_DIR}/abl/adump/inc/adump
    ${TOP_DIR}/abl/atrace/inc/utrace
)

#hcom_opskernel_buildert头文件
target_include_directories(hcom_opskernel_builder PRIVATE
    ${TOP_DIR}/inc
    ${TOP_DIR}/metadef/inc
    ${TOP_DIR}/graphengine/inc
    ${TOP_DIR}/inc/external
    ${TOP_DIR}/inc/aicpu
    ${TOP_DIR}/metadef/inc/graph
    ${TOP_DIR}/libc_sec/include
    ${TOP_DIR}/open_source/json/include
    ${TOP_DIR}/abl/qos/qosmng
    ${CMAKE_CURRENT_SOURCE_DIR}/../inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/mc2_handler
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template/component/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/task
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/resource_manager
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/coll_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/alg_research/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/common/debug/profiling/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/config
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/hashtable
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl_heterog/rpc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl/hccl_comm/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/tbe_vector_reduce
    ${CMAKE_CURRENT_SOURCE_DIR}/../hcom_graph_adaptor/ge_plugin/hcom
    ${TOP_DIR}/metadef/inc/common
    ${TOP_DIR}/metadef/inc/common/util
    ${TOP_DIR}/graphengine/inc/framework
    ${TOP_DIR}/metadef/inc/external
    ${TOP_DIR}/graphengine/inc/external
    ${TOP_DIR}/metadef/inc/external/graph
    ${TOP_DIR}/metadef/inc/exe_graph/lowering
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/proto/hcom_graph_adaptor_proto
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/common
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hvd
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/auto_tuning
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/calculation_tool
    ${CMAKE_CURRENT_SOURCE_DIR}/hcom_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/evaluator
    ${TOP_DIR}/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/trace_manager
    ${TOP_DIR}/abl/adump/inc/adump
    ${TOP_DIR}/abl/atrace/inc/utrace
    ${TOP_DIR}/metadef/inc/register
)

#hvd_opskernel_builder头文件
target_include_directories(hvd_opskernel_builder PRIVATE
    ${TOP_DIR}/inc
    ${TOP_DIR}/metadef/inc
    ${TOP_DIR}/graphengine/inc
    ${TOP_DIR}/inc/external
    ${TOP_DIR}/inc/aicpu
    ${TOP_DIR}/metadef/inc/graph
    ${TOP_DIR}/libc_sec/include
    ${TOP_DIR}/open_source/json/include
    ${TOP_DIR}/abl/qos/qosmng
    ${CMAKE_CURRENT_SOURCE_DIR}/../inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/mc2_handler
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template/component/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/task
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/resource_manager
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/coll_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/alg_research/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/common/debug/profiling/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/config
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/hashtable
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl_heterog/rpc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl/hccl_comm/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/tbe_vector_reduce
    ${CMAKE_CURRENT_SOURCE_DIR}/../hcom_graph_adaptor/ge_plugin/hcom
    ${TOP_DIR}/metadef/inc/common
    ${TOP_DIR}/metadef/inc/common/util
    ${TOP_DIR}/graphengine/inc/framework
    ${TOP_DIR}/metadef/inc/external
    ${TOP_DIR}/graphengine/inc/external
    ${TOP_DIR}/metadef/inc/external/graph
    ${TOP_DIR}/metadef/inc/exe_graph/lowering
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/proto/hcom_graph_adaptor_proto
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/common
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hvd
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/auto_tuning
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/calculation_tool
    ${CMAKE_CURRENT_SOURCE_DIR}/hcom_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/evaluator
    ${TOP_DIR}/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/trace_manager
    ${TOP_DIR}/abl/adump/inc/adump
    ${TOP_DIR}/abl/atrace/inc/utrace
    ${TOP_DIR}/metadef/inc/register
)

#hcom_gradtune_opskernel_builder头文件
target_include_directories(hcom_gradtune_opskernel_builder PRIVATE
    ${TOP_DIR}/inc
    ${TOP_DIR}/metadef/inc
    ${TOP_DIR}/graphengine/inc
    ${TOP_DIR}/inc/external
    ${TOP_DIR}/inc/aicpu
    ${TOP_DIR}/metadef/inc/graph
    ${TOP_DIR}/libc_sec/include
    ${TOP_DIR}/open_source/json/include
    ${TOP_DIR}/abl/qos/qosmng
    ${CMAKE_CURRENT_SOURCE_DIR}/../inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/mc2_handler
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/alg_template/component/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/task
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/legacy/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/base/communicator/legacy
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/operator
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/resource_manager
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/impl/coll_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/algorithm/alg_research/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/common/debug/profiling/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/config
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/framework/common/src/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/pub_inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/inc/hashtable
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl_heterog/rpc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/hccl/hccl_comm/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/inc/adapter
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/common/topo
    ${CMAKE_CURRENT_SOURCE_DIR}/../hccl/platform/tbe_vector_reduce
    ${CMAKE_CURRENT_SOURCE_DIR}/../hcom_graph_adaptor/ge_plugin/hcom
    ${TOP_DIR}/metadef/inc/common
    ${TOP_DIR}/metadef/inc/common/util
    ${TOP_DIR}/graphengine/inc/framework
    ${TOP_DIR}/metadef/inc/external
    ${TOP_DIR}/graphengine/inc/external
    ${TOP_DIR}/metadef/inc/external/graph
    ${TOP_DIR}/metadef/inc/exe_graph/lowering
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_BINARY_DIR}/proto/hcom_graph_adaptor_proto
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/common
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hcom
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/hvd
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/auto_tuning
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin
    ${CMAKE_CURRENT_SOURCE_DIR}/ge_plugin/calculation_tool
    ${CMAKE_CURRENT_SOURCE_DIR}/hcom_executor
    ${CMAKE_CURRENT_SOURCE_DIR}/evaluator
    ${TOP_DIR}/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/error_manager
    ${TOP_DIR}/metadef/inc/common/util/trace_manager
    ${TOP_DIR}/abl/adump/inc/adump
    ${TOP_DIR}/abl/atrace/inc/utrace
    ${TOP_DIR}/metadef/inc/register
)
add_subdirectory(ge_plugin)
add_subdirectory(hcom_executor)
add_subdirectory(evaluator)

#hcom_graph_adaptor依赖的so,链接选项
target_link_libraries(hcom_graph_adaptor PRIVATE
    $<BUILD_INTERFACE:intf_pub_cxx14>
    $<BUILD_INTERFACE:slog_headers>
    $<BUILD_INTERFACE:msprof_headers>
    $<BUILD_INTERFACE:mmpa_headers>
    $<BUILD_INTERFACE:hccl_headers>
    $<BUILD_INTERFACE:runtime_headers>
    $<BUILD_INTERFACE:cce_headers>
    $<BUILD_INTERFACE:network_headers>
    -Wl,--no-as-needed
    c_sec
    slog
    runtime
    mmpa
    ascend_protobuf
    graph
    exe_graph
    lowering
    gert
    platform
    hccl_heterog
    error_manager
    -Wl,--as-needed
    -lpthread
    ofed_headers
)

#hcom_executor依赖的so,链接选项
target_link_libraries(hcom_executor PRIVATE
    $<BUILD_INTERFACE:intf_pub_cxx14>
    $<BUILD_INTERFACE:slog_headers>
    $<BUILD_INTERFACE:msprof_headers>
    $<BUILD_INTERFACE:mmpa_headers>
    $<BUILD_INTERFACE:hccl_headers>
    $<BUILD_INTERFACE:runtime_headers>
    $<BUILD_INTERFACE:cce_headers>
    $<BUILD_INTERFACE:network_headers>
    -Wl,--no-as-needed
    c_sec
    slog
    runtime
    mmpa
    ascend_protobuf
    graph
    hccl_heterog
    error_manager
    -Wl,--as-needed
    -lpthread
    ofed_headers
    ascend_dump
)

#hcom_opskernel_builder依赖的so,链接选项
target_link_libraries(hcom_opskernel_builder PRIVATE
    $<BUILD_INTERFACE:intf_pub_cxx14>
    $<BUILD_INTERFACE:slog_headers>
    $<BUILD_INTERFACE:msprof_headers>
    $<BUILD_INTERFACE:mmpa_headers>
    $<BUILD_INTERFACE:hccl_headers>
    $<BUILD_INTERFACE:runtime_headers>
    $<BUILD_INTERFACE:cce_headers>
    $<BUILD_INTERFACE:network_headers>
    -Wl,--no-as-needed
    c_sec
    slog
    runtime
    mmpa
    ascend_protobuf
    graph
    hccl_heterog
    register
    error_manager
    -Wl,--as-needed
    -lpthread
    ofed_headers
)

#hvd_opskernel_builder依赖的so,链接选项
target_link_libraries(hvd_opskernel_builder PRIVATE
    $<BUILD_INTERFACE:intf_pub_cxx14>
    $<BUILD_INTERFACE:slog_headers>
    $<BUILD_INTERFACE:msprof_headers>
    $<BUILD_INTERFACE:mmpa_headers>
    $<BUILD_INTERFACE:hccl_headers>
    $<BUILD_INTERFACE:runtime_headers>
    $<BUILD_INTERFACE:cce_headers>
    $<BUILD_INTERFACE:network_headers>
    -Wl,--no-as-needed
    c_sec
    slog
    runtime
    ascend_protobuf
    graph
    mmpa
    hccl_heterog
    register
    error_manager
    -Wl,--as-needed
    -lpthread
    ofed_headers
)

#hcom_gradtune_opskernel_builder依赖的so,链接选项
target_link_libraries(hcom_gradtune_opskernel_builder PRIVATE
    $<BUILD_INTERFACE:intf_pub_cxx14>
    $<BUILD_INTERFACE:slog_headers>
    $<BUILD_INTERFACE:msprof_headers>
    $<BUILD_INTERFACE:mmpa_headers>
    $<BUILD_INTERFACE:hccl_headers>
    $<BUILD_INTERFACE:runtime_headers>
    $<BUILD_INTERFACE:cce_headers>
    $<BUILD_INTERFACE:network_headers>
    -Wl,--no-as-needed
    c_sec
    slog
    runtime
    ascend_protobuf
    graph
    hccl_heterog
    register
    mmpa
    error_manager
    -Wl,--as-needed
    -lpthread
    ofed_headers
)
install(TARGETS hcom_graph_adaptor  OPTIONAL
    LIBRARY DESTINATION lib
)
install(TARGETS hcom_executor  OPTIONAL
    LIBRARY DESTINATION lib
)
install(TARGETS hcom_opskernel_builder  OPTIONAL
    LIBRARY DESTINATION lib
)
install(TARGETS hvd_opskernel_builder  OPTIONAL
    LIBRARY DESTINATION lib
)
install(TARGETS hcom_gradtune_opskernel_builder  OPTIONAL
    LIBRARY DESTINATION lib
)

